package com.shao.onlinepdf.conf;

import com.shao.onlinepdf.excep.ExceptionPreHandleInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author shaohuailin
 * @date 2021/12/6
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private ExceptionPreHandleInterceptor exceptionPreHandleInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 全局异常处理的拦截器
        registry.addInterceptor(exceptionPreHandleInterceptor).addPathPatterns("/**");
    }
}
